#!/bin/bash

#必须是root用户才可以执行
if [ $UID -ne 0 ]; then
    echo "Superuser privileges are required to run this script."
    echo "e.g. \"sudo $0\""
    exit 1
fi

# 安装jenkins，需要设置端口，8088
echo "starting to install jenkins"
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
# 开放8088端口
firewall-cmd --zone=public --add-port=8088/tcp --permanent

# 启动jenkins
service jenkins start